package com.manster.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 配置文件加载常量类
 * @Author manster
 * @Date 2022/3/13
 **/
@Component
public class Const implements InitializingBean {


    public static final String DEFAULT_PASSWORD = "123456";
    public static final String DEFAULT_AVATAR = "https://picsum.photos/seed/picsum/200/200";
    @Value("${manster.captchakey}")
    private String captchakey;
    @Value("${manster.jwt.header}")
    private String header;
    @Value("${manster.jwt.expire}")
    private Long expire;
    @Value("${manster.jwt.secret}")
    private String secret;

    public static String CAPTCHA_KEY; //验证码key
    public static String HEADER; //jwt头部
    public static Long EXPIRE; //jwt过期时间
    public static String SECRET; //jwt秘钥

    @Override
    public void afterPropertiesSet() throws Exception {
        CAPTCHA_KEY = captchakey;
        HEADER = header;
        EXPIRE = expire;
        SECRET = secret;
    }
}
